<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>百家乐</title>
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/bootstrap.css">
    <!-- <link rel="stylesheet" href="__PUBLIC__/Admin/css/font-awesome.min93e3.css"> -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/style.css">
    <script src="__PUBLIC__/Admin/js/jquery.min.js"></script>
    <script src="__PUBLIC__/Admin/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/Common/layer/layer.js"></script>
    <!--百家乐往期盘数据-->
    <script src="__PUBLIC__/Admin/js/script.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-dark">
    <div class="container">
        <!-- Brand/logo -->
        <div>
            <a class="navbar-brand ctrl" href="#">开奖控制器</a>
            <div style="
    display: block;
    border: 1px solid #eaeaea;
    font-size: 14px;
    color: #666;
    padding: 2px 6px;
            ">实时码量：<span id="txtSSML">0</span><a style="color: #fff;padding: 2px 6px;background: #acacac;font-size:  12px;cursor:  pointer;margin-left: 8px;" id="btnSSML">修改</a></div>
        </div>
        <div>
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link1" style="color: red;">庄：<span id="count_z">0</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" style="color: blue">闲：<span id="count_x">0</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" style="color:green;">和：<span id="count_h">0</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" style="color: black">庄对：<span id="count_zd">0</span></a>
                </li>

                <li class="nav-item">
                    <a class="nav-link1" style="color: black">闲对：<span id="count_xd">0</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" style="color: black">对子：<span id="count_dz">0</span></a>
                </li>

                <li class="nav-item">
                    <a class="nav-link1" style="color: black">三宝：<span id="count_sb">0</span></a>
                </li>
            </ul>
            <ul class="navbar-nav" style="float: right;">
                <li class="nav-item">
                    <a class="nav-link1" style="color: black">对冲(虚)：<span id="count_dc">-</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" style="color: black">对冲(实)：<span id="count_dcs">-</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" id="btn_yjcz" style="color: #fff;padding: 4px;background: #acacac;font-size:  12px;cursor:  pointer;">一键撤注</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link1" id="btn_qkld" style="color: #fff;padding: 4px;background: #acacac;font-size:  12px;cursor:  pointer;">清空路单</a>
                </li>
            </ul>
        </div>
    </div>
</nav>
    <div class="container">
        <table class="table table-striped table-hover table-bordered">
            <thead style="background-color:rgba(0, 0, 0, 0.05);">
            <tr>
                <th>期号</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="tbody" istype="0">

            </tbody>
        </table>
    </div>
</body>
<script>
    $(function () {
        function updateA1(){
            $.post("{:U('Hold/findBet')}",{type:0},(e)=>{
                e=eval("("+e+")");
                if(e.code==="200"){
                    window.parent.has_points=e.content.has_points;
                    $("#txtSSML").html(window.parent.has_points);
                }
            });
        }

        setInterval(updateA1,2000);
        $("#btnSSML").click(()=>{
            //更新
            let data=window.prompt("请修改码量",$("#txtSSML").html());
            if(data){
                if(!isNaN(data)){
                    try{
                        $.post("{:U('Hold/publishPoints')}",{bet_points:data,type:0},function(json){
                            updateA1();
                        })
                    }catch (e) {
                        alert("请输入正确的码量")
                    }
                }else{
                    alert("请输入正确的码量")
                }

            }
        });
        var fun=()=>{
            $.post("{:U('Hold/hundredNote')}",{type:0},(it)=>{
                let mo=eval('('+it+')').content;
                if(mo){
                    document.querySelector('#count_z').innerHTML=mo.zhuang;
                    document.querySelector('#count_x').innerHTML=mo.xian;
                    document.querySelector('#count_h').innerHTML=mo.he;
                    document.querySelector('#count_zd').innerHTML=mo.zhuangdui;
                    document.querySelector('#count_xd').innerHTML=mo.xiandui;
                    document.querySelector('#count_dz').innerHTML=mo.duizhi;
                    document.querySelector('#count_sb').innerHTML=mo.sanbao;
                    // document.querySelector('#count_dc').innerHTML=mo.zhuangxian*1>0?'庄'+mo.zhuangxian:mo.zhuangxian*1!=0?'闲'+mo.zhuangxian*-1:'-';
                    document.querySelector('#count_dc').innerHTML=mo.dc;
                    document.querySelector('#count_dcs').innerHTML=mo.dc_s;
                }
            })
        };
        fun();
        window.zxTime=setInterval(fun,2000);
        $('#btn_yjcz').click(function(){
            if(confirm('确定要撤注吗?')){
                $.post("{:U('Hold/clearBet')}",{
                    type:0
                },function(e){
                    console.log(e);
                    e=eval('('+e+')');
                    if(e.code==="200"){
                        alert('撤注成功！');
                    }
                })
            }
        });
        $('#btn_qkld').click(function(){
            if(confirm('确定要清空路单吗?')){
                $.post("{:U('Hold/clearHistory')}",{
                    type:0
                },function(e){
                    console.log(e);
                    e=eval('('+e+')');
                    if(e.code==="200"){
                        alert('清空路单成功！');
                        location.href=location.href;
                    }
                })
            }
        });
    })

</script>
</html>